package com.frx.sort;

/**
 * Created by xurenfeng on 2019/2/15.
 * 选择排序
 */
public class SelectSort<T extends Comparable<T>> extends Sort<T>{
    public static void main(String[] args){

    }

    @Override
    public void sort(T[] nums) {
        int N = nums.length;
        for (int i = 0;i<N;i++){
            int min = i;
            for (int j = i+1;j<N;j++){
                if (less(nums[j],nums[i])){
                    min = j;
                }
            }
            swap(nums,i,min);
        }
    }
}
